package com.oa.lms.apps.dao.absence.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oa.lms.apps.dao.absence.IReplyOrderDao;
import com.oa.lms.apps.entity.absence.ReplyOrderValue;

public class ReplyOrderDaoImpl extends HibernateDaoSupport implements
		IReplyOrderDao {
	List<ReplyOrderValue> list;

	@Override
	public Integer add(ReplyOrderValue replyOrderValue) {
		if (replyOrderValue != null) {
			this.getHibernateTemplate().save(replyOrderValue);
		}
		return replyOrderValue.getReplyId();
	}

	@Override
	public void modify(ReplyOrderValue replyOrderValue) {
		if (replyOrderValue != null) {
			this.getHibernateTemplate().update(replyOrderValue);
		}
	}

	@Override
	public ReplyOrderValue queryByReplyId(Integer ReplyId) {
		if (ReplyId != null) {
			return (ReplyOrderValue) this.getHibernateTemplate().get(ReplyOrderValue.class, ReplyId);
		}
		return null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ReplyOrderValue> queryReplyOrder(final ReplyOrderValue replyOrderValue) {
		String hqlStr = "FROM ReplyOrderValue rov WHERE rov.absenceOrder =?";
		return this.getHibernateTemplate().find(hqlStr, replyOrderValue.getAbsenceOrder());
	}

	public List<ReplyOrderValue> getList() {
		return list;
	}

	public void setList(List<ReplyOrderValue> list) {
		this.list = list;
	}
	
	}


